package day07;

import java.util.Scanner;

public class CalAirPrice {
    public static void main(String[] args) {

        Scanner scan=new Scanner(System.in);

        System.out.println("请输入机票原价");
        double price=scan.nextDouble();
        System.out.println("请输入月份");
        int month=scan.nextInt();
        System.out.println("请输入舱位类型:1.头等舱 2.商务舱 3.经济舱");
        int num=scan.nextInt();
        double finalPrice=airPrice(price,month,num);
        if(finalPrice!=-1){
            System.out.println("最终价格为："+finalPrice);
        }




    }
    public static double airPrice(double price,int month,int num){
        if(month<1||month>12){
            System.out.println("月份输入错误");
            return -1;
        }
        if(num>3){
            System.out.println("舱位选择错误");
            return -1;
        }
        switch(num){
            case 1:
                if(month>=5&&month<=10){
                    price*=0.9;
                }else{
                    price*=0.7;
                }
                break;
            case 2:
                if(month>=5&&month<=10){
                    price*=0.85;
                }else{
                    price*=0.65;
                }
                break;
            case 3:
                if(month>=5&&month<=10){
                    price*=0.8;
                }else{
                    price*=0.6;
                }
                break;

        }
        return price;

    }
}
